*! rd_medicaid5.ado updates rd_medicaid4.ado,

*! medicaid version 5  November 21, 2013 ed Dec. 11, 2013
*! This code rewrites the medicaid.mcr macro by Dan Rosenbaum
*! for the 1988-1996 years into a Stata ado file. It also 
*! updates his original program to include expansions in 
*! eligibility for Medicaid and SCHIP through January 2012. 
*! 		--- written by Laura Wherry
/************************************************************
INTRODUCTION
I preserve the structure of the original calculator 
created by Dan Rosenbaum (DR). First mandatory %FPL cutoffs 
for eligibility are coded at the federal level. Next,
optional %FPL cutoffs are coded at the state level. Finally, 
the calculator compares the greater of the two cutoffs 
to family income to determine eligibility. 

I have converted all SAS code for the 1988-1996 years into 
Stata. I have preserved all original comments made by DR
and marked any edits or additions made by myself to the code
for these years. In addition, I have added eligibility rules 
for the 1997-2011 years (updated through 2012).

Additional details on sources and any assumptions made
may be found in the notes section included at the beginning of 
this program. 
**************************************************************
IMPORTANT
This code is written in such a manner that later expansions 
overwrite older ones, so that in general lines are not 
interchangeable. Also, the state codes have been written keeping
in mind that at the end of the program, the maximum value of the 
state and federal codings is taken. Without this step, state 
codings may not stand alone and may be incorrect.
**************************************************************
SOURCES
Used by Dan Rosenbaum: 
(1) IHPP1 - Major Changes in State Medicaid and Indigent Care 
	Programs, Intergovernmental Health Policy Project, 1987-1993, 
	IC means that data was found in the Indigent Care section
(2) MSB - Medicaid Source Book, U.S. House of Representatives,
	Committee on Energy and Commerce, 1988 and 1993
(3) MCH - Maternal and Child Update, National Governors Association,
	5/93, 12/93, 2/94, 8/94, 3/95, 9/95, 3/96, and 9/96
Used by Laura Wherry:
(1) MCH - Maternal and Child Update, National Governors Association, 
	9/97, 9/98, 2/99, 1/00, 2/01, 2/02, 2/03, 9/06, 11/08, 01/11
(2) HMA - Enrollment Increases in State CHIP Programs: December 
	1998 to June 1999, July 30, 1999 prepared by Vernon K. Smith 
	at Health Management Associates for the Kaiser Commission on 
	Medicaid and the Uninsured. 
(3) MPR - Implementation of the State Children's Health Insurance 
	Program: Momentum Is Increasing After a Modest Start: First 
	Annual Report, January 2001 report prepared by Mathematica 
	Policy Research, Inc.
(4) KFF - Kaiser Commission on Medicaid and the Uninsured released 
	mostly annual surveys of state Medicaid/SCHIP programs 
	beginning in 2000: available for years 2000, 2002, 2003-2009, 
	2011-2012
	at http://www.kff.org/medicaid/50StateSurvey.cfm
*****************************************************************
NOTES BY DAN ROSENBAUM
(1) The best data are from IHPP1 87-90, where implementation dates
	are typically specified.  One caveat is that phase-in rules
	are typically not specified.  For phase-ins increasing (in age)
	by one year during each year, I assumed that the phase-in was
	by month, meaning that eligibility was determined by birth
	month until phase-in was completed.
(2) For all IHPP1 expansions, I assumed that children born before
	October 1983 were NOT covered, since presumably state funds
	would be necessary to finance these "violation" of Federal
	Medicaid rules.  However, the MCH data suggested many
	expansions that employed state funds, so I dropped this
	assumption when I used the MCH data.
(3) In IHPP1 91-93, implementation dates are not given.  Unless I
	was able to detect a pattern from earlier expansions or had
	other information, I assumed that implementation occurred in
	July of the given year.  Also, the data appears to be less
	complete in these years.
(4) MSB 93 gives information as of January 1992, which I assume is
	the implementation date.
(5) The MSB 93 and MCH data gives information as of a given date,
	so I assume that the implementation date is halfway between
	that date and the given date for the prior version.  If
	there is no prior version, I assume that the given date is
	the implementation date.
				DATE IN		IMPLEMENTATION DATES
	PUBLICATION	TABLE		PREGNANT	ALL ELSE
	MSB 93		9201		9201		N/A
	MCH 5/93	9301		9207		9207
	MCH 12/93	9307		9304		9304
	MCH 2/94	9401		9310		9310
	MCH 8/94	9407		9404		9404
	MCH 3/95	9502		9411		9411
	MCH 9/95	9508		9505		9505
	MCH 3/96	9602		9511		9511
	MCH 9/96	9608		9605		9605
(6) Once in awhile the MCH data shows a state expanding its Medicaid
	program and then changing back six months or a year later.
	Many of these look like typographical errors, so I ignored
	these changes.
(7) States started to fund expansions beyond the guidelines set by
	Federal Medicaid laws starting in about 1993.  However,
	starting with MCH 9/95 these expansions appear to be ignored
	in the MCH data, our only data for that time period.	
*********************************************************************
NOTES BY LAURA WHERRY
(1) The eligibility levels listed are identified by coverage 
	under Medicaid expansions (smedpct) or separate state programs
	(schipct). States may have a combination of the two depending on 
	the state-specific plan.  
(2) I used MCH as the primary source for the length of time period, 
	1997-2007. Although the MCH reports consistently reported eligibility
	thresholds, I often needed to supplement information drawn from 
	this source to locate the exact date of implementation for the 
	expansions in question. Also, the MCH reports usually did not 
	distinguish between SCHIP-funded Medicaid expansions and separate 
	state programs under SCHIP when reporting eligibilty thresholds
	by state. I describe below the sources used to find this information.
	However, if there were any discrepancies between sources, the general 
	rule was to follow the MCH updates or to make a note otherwise.
	For 2008-2012 rules, I followed KFF reports. 
(3)	The MCH udpates give information as of a given date and rarely
	have the exact date of implementation (although if it did, this 
	date was used rather than the methods described here). Thus, 
	I supplemented with the exact implementation date from HMA or 
	MPR when available. When this was not possible, for all eligibility 
	rules taken from MCH reports for 2003 or before, I assume that the 
	implentation date is halfway between that date and the given date 
	for the prior version (following DR's approach). For changes in 
	eligibility rules reported in the 9/06 or 11/08 MCH reports, I 
	decided to use an alternative approach since MCH reports were no 
	longer being released on an annual basis. For changes reported in 
	these two issues, I referred to the KFF reports and found the 
	annual issue that first reported the change in question. In some
	instances, the KFF report included the exact date of implementation.
	When this was not the case, since KFF also gives information as 
	of a given date, I assume the implementation date is halfway 
	between the date and the given date for the prior KFF version. 

	DATE OF			DATE TO WHICH	ASSUMED
	PUBLICATION		INFO REFERS		IMPLEMENTATION DATE
	MCH 9/96		9608			N/A
	MCH 9/97		9710			9703
	MCH 9/98		9710			9703
	MCH 2/99		9810			9804
	MCH 1/00		9910			9904
	MCH 2/01		10010			10004
	MCH 2/02		10110			10104
	MCH 2/03		10210			10204
	KFF 6/02		10201			N/A
	KFF 7/03		10304			10209
	KFF 10/04		10407			10312
	KFF 10/05		10507			10501
	KFF 1/07		10607			10601
	KFF 1/08		10801			10710
	
 	Often the information on implementation of eligibility changes for
	pregnant women was not as extensive as information on changes for 
	children. For this reason, when I was able to locate the exact date 
	of implementation for eligibility rules for children and changes 
	in eligibility for pregnant women were also reported in the same 
	MCH update for the same state, I assumed the same date of 
	implementation for all changes in eligibility (for children and 
	pregnant women). 		
(4) The MCH reports rarely distinguish between SCHIP-funded Medicaid 
	expansions and separate state programs under SCHIP when reporting 
	eligibilty thresholds by state and year. Therefore, I drew this 
	information primarily from HMA 99 and the series of KFF state surveys.
	In some cases, the KFF reports revealed subtle changes in eligibility
	rules for state Medicaid versus separate state programs that were not 
	captured in the MCH reports. I have added in this information citing
	the appropriate KFF reports. 
(5)	Information on eligibility of 19 year olds was very 
	inconsistent both in availability and content across sources and 
	years, for this reason, I would not trust this program to 
	accurately measure the eligibility of 19 year olds. Also, in some
	cases upper age was assumed to be 18 since the Kaiser Family Foundation
	reports that state Medicaid and CHIP programs typically provide
	coverage through the child's 19th birthday (see footnote 2 on Table 1A
	in KFF 2012)
(6) We only examine income eligibility for public health insurance
	in this program and do not examine the presence of any premium
	or cost-sharing requirements involved in coverage. 
(7) This calculator does not consider differences in either presumptive
	or continuous eligibility for SCHIP programs across states. It also
	ignores provisions relating to transitional medical assistance
	under Medicaid. 
********************************************************************/
capture program drop rd_medicaid5
program rd_medicaid5
	version 10.0

	/*	deleting all "unborn" children and creating pregnant woman or 
		infant variable (pwi) to make coding easier*/
		*drop if agem<0
		gen pwi=1*(agem==0 | pregnant)

	*	Federal Medicaid mandates 
		gen fmedpct=75 if (date>=8907 & pwi)
		*ed. by LW, 05/17/09 to add second part of MCCA law
	    replace fmedpct=100 if (date>=9007 & pwi)
		replace fmedpct=133 if (date>=9004 & (pwi | agem<6))
		replace fmedpct=100 if (date>=9107 & birthday>=8310 & ///
			inrange(agem,6,18))

	*	State Medicaid/SCHIP mandates
		gen smedpct=.
		gen schipct=.

		*Alabama, 63
			*IHPP1 88	 	
			replace smedpct=100 if pwi & state2==63 & date>=8807
			*HMA 99
			replace smedpct=100 if agem<19 & state2==63 & date>=9802
			*MCH 99, HMA 99
			replace schipct=200 if agem<19 & state2==63 & date>=9809
			/*LW: MCH 02 specifies that pregnant women under the age of 19 are
			covered by SCHIP in Alabama for this year. But this is the case in 
			general, so I have not included here. It is coverage by SCHIP of 
			pregnant women older than age 19 that requires special approval
			from HHS. See footnote to Table 8 in MCH 06*/
			*KFF 12/09
			replace schipct=300 if agem<20 & state2==63 & date>=10910

		*Alaska, 94
			*IHPP1 88		
			replace smedpct=100 if (pwi | (birthday>=8802 & agem<2)) & ///
				state2==94 & date>=8901
			*MCH 00, HMA 99
			replace smedpct=200 if agem<20 & state2==94 & date>=9903
			replace smedpct=200 if pregnant & state2==94 & date>=9903
			/*MCH 06, Alaska's FPL guidelines were lowered due to a 
			legislative change in Sept. 2003 from 200% FPL to 175% FPL 
			and frozen at the 2003 FPL guideline standard. The frozen 
			standard leads to a decline each year in the FPL guidelines for 
			children and pregnant women. The month when the new annual 
			FPL guidelines become effective each year is April.*/ 
			replace smedpct=175 if (agem<20 | pregnant) & state2==97 & date>=10309
			replace smedpct=170 if (agem<20 | pregnant) & state2==97 & date>=10404
			replace smedpct=164 if (agem<20 | pregnant) & state2==97 & date>=10504
			replace smedpct=160 if (agem<20 | pregnant) & state2==97 & date>=10604
			*MCH 08
			replace smedpct=154 if (agem<20 | pregnant) & state2==97 & date>=10704

		*Arizona, 86 
			*IHPP1 87 (FS elig.) 	
			replace smedpct=100 if agem<6 & state2==86 & date>=8810
			*MSB 88 		
			replace smedpct=100 if (pwi | agem<2) & state2==86 & date>=8801
			*IHPP1 87 (FS elig.) 	
			replace smedpct=100 if agem<13 & state2==86 & date>=8810
			*IHPP1 90 		
			replace smedpct=100 if birthday>=8310 & agem<19 & state2==86 & ///
				date>=9004 
			*MSB 93 		
			replace smedpct=140 if pwi & state2==86 & date>=9201
			*MCH 5/93 		
			replace smedpct=100 if inrange(agem,1,13) & state2==86 & date>=9301 
			*MCH 00, HMA 99
			replace smedpct=100 if inrange(agem,15,18) & state2==86 & ///
				date>=9904
			/*LW: HMA specifies 200% FPL phased in starting in Nov-98. MCH 00
			report does not specify birthday for phase-in but MCH 01 does and
			I've used this information here.*/
			replace schipct=200 if agem<15 & birthday>=9810 & state2==86 & ///
				date>=9811
			replace schipct=200 if inrange(agem,15,18) & birthday>=8310 & ///
				state2==86 & date>=9811
			/*LW: MCH 02 specifies that pregnant women under the age of 19 are
			covered by SCHIP in Arizona for this year. But this is the case in 
			general, so I have not included here. It is coverage by SCHIP of 
			pregnant women older than age 19 that requires special approval
			from HHS. See footnote to Table 8 in MCH 06*/
			*MCH 03
			replace smedpct=140 if pregnant & state2==86 & date>=10204
			*MCH 06
			replace smedpct=133 if pregnant & state2==86 & date>=10406
			*MCH 08
			replace schipct=200 if pregnant & state2==86 & date>=10610
			*LW: KFF 01/11 notes an enrollment freeze on CHIP program on 12/21/09
			*I do not model that here

		*Arkansas, 71
	        *DR: MSB 93 increase in questionable 
			*IHPP1 87 		
			replace smedpct=75 if (pwi | (birthday>=8310 & agem<5)) & ///
				state2==71 & date>=8704
			*IHPP1 88 		
			replace smedpct=100 if pwi & state2==71 & date>=8802
			*IHPP1 88 		
			replace smedpct=100 if birthday>=8310 & agem<5 & state2==71 & ///
				date>=8807
			*IHPP1 89 		
			replace smedpct=100 if birthday>=8310 & agem<7 & state2==71 & ///
				date>=8910
			*MSB 93 		
			replace smedpct=185 if pwi & state2==71 & date>=9201
			*MCH 5/93 		
			replace smedpct=133 if pwi & state2==71 & date>=9207
			*LW: Disregard HMA reported expansion that disagrees with MCH 
			*MCH 9/97
			replace smedpct=200 if state2==71 & agem<19 & date>=9709
			/*LW: There are some inconsistencies and discrepancies in the last 
			10 years of MCH reports regarding whether eligibility remains 
			at 200% FPL or returns to 100% FPL and for which ages. However, 
			KFF reports seem to support the notion that eligibility remains 
			at 200% FPL. This is what I follow here.*/
			*MCH 03
			replace smedpct=200 if state2==71 & pregnant & date>=10204
			*MCH 06
			/*LW: Assume implementation date halfway between date given in MCH 06
			report (February 2006) and date given in MCH 03 report (Oct 2002)*/
			replace schipct=200 if pregnant & state2==71 & date>=10406

		*California, 93
	        *DR: Ignored MSB 93 pwi=185,
	        *Post 1993 data is questionable due to inconsistencies in MCH data 
			*IHPP1 91 		
			replace smedpct=200 if pwi & state2==93 & date>=9107
			*MCH 5/93 		
			/*LW: Technically Medicaid covers pregnant women and infants up to 
			200% FPL. However, CA has another program that provides coverage to 
			pregnant women and children up to age 2 up to 250% FPL. I'm going 
			to follow DR as coding this under Medicaid here. However, in later 
			years (following the BBA 1997), I code it as a separate SCHIP state
			program since the MCH reports that this program does receive SCHIP 
			funding.*/
			replace smedpct=250 if (pwi | agem<2) & state2==93 & date>=9207
			*MCH 9/95 		
			replace smedpct=100 if inrange(agem,2,18) & state2==93 & date>=9505
			*LW: MCH 9/97 contradicts MCH 9/96 and MCH 2/96, ignore 
			*MCH 99, HMA 99
			/*LW: HMA specifies that the group 14-19 at 200% FPL is Medicaid 
			while 1-19 ages are 200% FPL under SCHIP. However this seems odd
			and contradicts later Kaiser reports. Therefore I ignore this 
			and consider all expansions to be under SCHIP as indicated in Kaiser.*/
			replace schipct=200 if inrange(agem,1,19) & state2==93 & date>=9807
			replace smedpct=200 if pwi & state2==93 & date>=9807
			replace schipct=250 if agem==0 & state2==93 & date>=9807
			replace schipct=300 if pregnant & state2==93 & date>=9807
			*MCH 00
			replace schipct=250 if agem<19 & state2==93 & date>=9904

		*Colorado, 84
	        *DR: Ignored IHPP1 89 pwi=150 as of July of 1991, since it is 
			*contradicted by MSB 93 and MCH documents 
			*MCH 99, HMA 99
			replace schipct=185 if agem<19 & state2==84 & date>=9804
			*MCH 02
			replace schipct=185 if pregnant & state2==84 & date>=10104
			*KFF 10/05, MCH 06
			replace schipct=200 if (agem<19 | pregnant) & state2==84 & date>=10501
			*KFF 01/11
			replace schipct=250 if agem<20 & state2==84 & date>=11005
			replace schipct=250 if pregnant & state2==84 & date>=11006
			*LW: KFF says pregnancy limit increased in 2010, I use date
			*halfway between December 2009 and January 2011 reports

		*Connecticut, 16 
			*MSB 88, IHPP1 87 	
			replace smedpct=100 if (pwi | (birthday>=8310 & agem<5)) & ///
				state2==16 & date>=8804
			*IHPP1 88 		
			replace smedpct=185 if pwi & state2==16 & date>=8901
			*IHPP1 90 		
			replace smedpct=100 if birthday>=8310 & inrange(agem,1,8) & ///
			 	state2==16 & date>=9101		
			*MCH 12/93 		
			replace smedpct=185 if agem<6 & state2==16 & date>=9304
			*MCH 8/94 		
			replace smedpct=185 if birthday>=8310 & agem<19 & state2==16 & ///
				date>=9404
			*MCH 9/97, HMA 99
			replace smedpct=185 if inrange(agem,14,15) & state2==16 & ///
				date>=9707
			replace smedpct=185 if agem==15 & state2==16 & date>=9710
			replace smedpct=185 if inrange(agem,17,18) & state2==16 & ///
				date>=9807
			*MCH 99, HMA 99
			replace schipct=300 if agem<19 & state2==16 & date>=9806

		*Delaware, 51 
			*MSB 88 		
			replace smedpct=100 if pwi & state2==51 & date>=8801
			*IHPP1 88 		
			replace smedpct=100 if agem<2 & state2==51 & date>=8807
			*IHPP1 91 		
			replace smedpct=185 if pwi & state2==51 & date>=9107
			*MCH 5/93 		
			replace smedpct=100 if inrange(agem,1,18) & state2==51 & date>=9207
			*MCH 00, HMA 99
			replace schipct=200 if agem<20 & state2==51 & date>=9902
			*MCH 01
			replace smedpct=200 if pregnant & state2==51 & date>=10004
			*KFF 6/02
			/*LW: Assume implementation date halfway between dates given in 2000
			(July 2000) and 2002 (January 2002) Kaiser surveys*/
			replace smedpct=200 if agem==0 & state2==51 & date>=10104

		*District of Columbia, 53 
			*MSB 88 		
			replace smedpct=100 if (pwi | agem<2) & state2==53 & date>=8704
			*IHPP1 88 		
			replace smedpct=100 if birthday>=8511 & agem<3 & state2==53 & ///
				date>=8710
			*IHPP1 90 		
			replace smedpct=185 if pwi & state2==53 & date>=9004
			*IHPP1 90 		
			replace smedpct=100 if birthday>=8310 & inrange(agem,1,7) & ///
				state2==53 & date>=9004
			*MCH 99, HMA 99
			replace smedpct=200 if (agem<19 | pregnant) & state2==53 & date>=9810
			*KFF 1/08, MCH 08
			replace smedpct=300 if (agem<19 | pregnant) & state2==53 & date>=10610

		*Florida, 59
	        *DR: Ignored IHPP1 92 pwi=150, since contradicted by MSB 93 and MCH 
			*MSB 88 		
			replace smedpct=100 if (pwi | agem<2) & state2==59 & date>=8710
			*IHPP1 88 		
			replace smedpct=100 if birthday>=8311 & agem<6 & state2==59 & ///
				date>=8810
			*IHPP1 89 		
			replace smedpct=150 if pwi & state2==59 & date>=8907
			*IHPP1 90 		
			replace smedpct=100 if birthday>=8310 & inrange(agem,1,8) & ///
				state2==59 & date>=9010
			*IHPP1 92 		
			replace smedpct=185 if pwi & state2==59 & date>=9207
			*MCH 99, HMA 99
			replace smedpct=100 if inrange(agem,15,19) & state2==59 & date>=9804
			replace schipct=200 if inrange(agem,1,19) & state2==59 & date>=9804
			/*LW: HMA does not mention an expansion of Medicaid for infants and 
			lump infants into the separate state SCHIP expansion, but both
			MCH and Kaiser reports indicate that infants are not covered under 
			separate SCHIP but under Medicaid. Therefore, that is what I have
			incorporated here.*/ 
			replace smedpct=200 if agem==0 & state2==59 & date>=9804

		*Georgia, 58 
			*IHPP1 88 		
			replace smedpct=100 if (pwi | agem<3) & state2==58 & date>=8901
			*MCH 5/93 		
			replace smedpct=150 if pwi & state2==58 & date>=9207
			*MCH 12/93 		
			replace smedpct=100 if inrange(agem,1,18) & state2==58 & date>=9304
			*MCH 2/94 		
			replace smedpct=185 if pwi & state2==58 & date>=9310
			*MCH 99, HMA 99
			replace schipct=200 if agem<19 & state2==58 & date>=9811
			replace smedpct=200 if pregnant & state2==58 & date>=9811
			*MCH 01
			replace schipct=235 if agem<19 & state2==58 & date>=10004
			replace smedpct=235 if pregnant & state2==58 & date>=10004
			/*LW: Kaiser reports indicate that infants are also covered at 200% FPL
			(and later 235% FPL) under Medicaid if child is born to mother who was 
			already enrolled in Medicaid. Assume implementation date halfway between 
			dates given Kaiser surveys*/
			*KFF 6/02
			replace smedpct=235 if agem==0 & state2==58 & date>=10104
			*KFF 10/04
			replace smedpct=200 if agem==0 & state2==58 & date>=10204

		*Hawaii, 95 
			*IHPP1 88 		
			replace smedpct=100 if pwi & state2==95 & date>=8901
			*IHPP1 89 		
			replace smedpct=185 if pwi & state2==95 & date>=9001
			*IHPP1 89 		
			replace smedpct=100 if birthday>=8310 & inrange(agem,1,7) ///
				& state2==95 & date>=9001
			*MCH 5/93 
			*ed LW, 9/7.09: changed to specify ages of children 
			replace smedpct=300 if (agem<=19 | pregnant) & date>=9207 & state2==95
			*MCH 9/96
			/*LW: footnote in MCH 9/96 mentions that children 
			with incomes higher than OBRA levels may be required to pay
			premiums. However, we are looking at income eligibility only 
			and not examining any cost-sharing. Confirmed w/Bruce in 9/2/09
			meeting.*/
			*MCH 99	
			replace smedpct=100 if agem<19 & state2==95 & date>=9804
			replace smedpct=133 if agem<6 & state2==95 & date>=9804
			replace smedpct=185 if pwi & state2==95 & date>=9804
			*LW: discrepancy b/w HMA 99 and MCH 00, 01, ignore HMA
			*MCH 00
			replace smedpct=185 if agem<19 & state2==95 & date>=9904
			*MCH 01, MPR 01
			replace smedpct=200 if agem<19 & state2==95 & date>=10007
			*MCH 02
			replace smedpct=200 if pregnant & state2==95 & date>=10104
			*MCH 03 
			/*LW: Here I assume that if you are under age 19 and pregnant
			you still qualify for Medicaid under the 200% FPL child threshold
			rather than the contracted Medicaid threshold for pregnant women.*/
			replace smedpct=185 if pregnant & agem>=19 & state2==95 & date>=10204

		*Idaho, 82 
			*IHPP1 88 		
			replace smedpct=67 if pwi & state2==82 & date>=8901
			*MCH 99, HMA 99
			replace smedpct=150 if agem<20 & state2==82 & date>=9710
			*KFF 10/04, MCH 06
			replace schipct=185 if agem<19 & state2==82 & date>=10312
			*KFF 1/07
			/*LW: Assume implementation date halfway between date given in KFF 10/05 
			(July 2005) and KFF 1/07 (July 2006)*/
			replace smedpct=133 if agem<6 & state2==82 & date>=10601
			replace smedpct=100 if agem<20 & state2==82 & date>=10601
			*KFF 1/08
			/*LW: Assume implementation date halfway between date given in KFF 1/07
			(July 2006)  and KFF 1/08 (Jan 2008)*/
			replace smedpct=133 if agem<20 & state2==82 & date>=10704
			*MCH 08
			/*LW: Assume implementation date halfway between date given in MCH 08
			report (Aug 2007) and date given in MCH 06 report (Feb 06)*/
			replace schipct=185 if pregnant & state2==82 & date>=10611

		*Illinios, 33 
			*IHPP1 88 		
			replace smedpct=100 if pwi & state2==33 & date>=8807
			*MCH 99, HMA 99
			/*LW: MCH 02 - 08 reports specify that infants born to women who were
			eligible for and receiving Medicaid at the time of birth are 
			eligible up to one year of age at 200% FPL. All other infants
			are eligible up to 133% FPL.*/
			replace smedpct=200 if pwi & state2==33 & date>=9801
			*HMA 99
			replace smedpct=133 if inrange(agem,1,19) & state2==33 & date>=9801
			*MCH 99, KFF 10/00 indicates this was a separate SCHIP program
			replace schipct=185 if inrange(agem,1,18) & state2==33 & date>=9804
			*KFF 10/04, MCH 06
			replace schipct=200 if agem<19 & state2==33 & date>=10312
			*MCH 08
			/*LW: Assume implementation date halfway between date given in MCH 08
			report (Aug 2007) and date given in MCH 06 report (Feb 06)*/
			replace schipct=200 if pregnant & state2==82 & date>=10611

		*Indiana, 32 
			*IHPP1 88 		
			replace smedpct=50 if pwi & state2==32 & date>=8807
			*IHPP1 89 		
			replace smedpct=100 if (pwi | agem<3) & state2==32 & date>=8907
			*IHPP1 89 		
			replace smedpct=150 if (pwi | agem<3) & state2==32 & date>=9107
			*MCH 97
			replace smedpct=100 if inrange(agem,14,18) & state2==32 & date>=9706
			*MCH 99, HMA 99
			replace smedpct=150 if agem<19 & state2==32 & date>=9807
			*MCH 01, KFF 10/00 indicates this was a separate SCHIP program
			replace schipct=200 if agem<19 & state2==32 & date>=10004
			*KFF 1/08
			/*LW: Assume implementation date halfway between date given in KFF 1/07
			(July 2006)  and KFF 1/08 (Jan 2008)*/
			replace smedpct=200 if agem==0 & state2==32 & date>=10704

		*Iowa, 42 
			*IHPP1 88 		
			replace smedpct=150 if pwi & state2==42 & date>=8901
			*IHPP1 88 		
			replace smedpct=100 if birthday>=8702 & inrange(agem,1,2) ///
				& state2==42 & date>=8901			
			*MSB 93 		
			replace smedpct=185 if pwi & state2==42 & date>=9201
			*MCH 99, HMA 99
			replace smedpct=133 if inrange(agem,6,18) & state2==42 & date>=9807
			*MCH 00, KFF 10/00 indicates this was a separate SCHIP program
			replace schipct=185 if inrange(agem,1,18) & state2==42 & date>=9904
			*MCH 01
			replace schipct=200 if inrange(agem,1,18) & state2==42 & date>=10004
			replace smedpct=200 if pwi & state2==42 & date>=10004
			*KFF 12/09
			replace smedpct=300 if (pwi | agem==1) & state2==42 & date>=10907
			replace schipct=300 if inrange(agem,2,19) & state2==42 & date>=10907

		*Kansas, 47 
			*IHPP1 88 		
			replace smedpct=100 if pwi & state2==47 & date>=8807
			*IHPP1 89 		
			replace smedpct=150 if pwi & state2==47 & date>=8907
			*IHPP1 89 		
			replace smedpct=100 if inrange(agem,1,4) & state2==47 & date>=8907
			*MCH 3/95-9/96 		
			replace smedpct=100 if birthday>=7909 & inrange(agem,1,18) & ///
				state2==47 & date>=9411
			*MCH 00, HMA 99
			replace schipct=200 if agem<19 & state2==47 & date>=9901
			*MCH 02
			replace schipct=200 if pregnant & state2==47 & date>=10104
			*MCH 03
			/*LW: The 200% expansion under SCHIP for pregnant women is only
			reported in MCH 02 and is not included in MCH 03. Since pregnant 
			women under age 19 are eligible for SCHIP (under the child eligibility
			threshold), I preserve that eligibility in the code below by
			specifying the contraction for those over age 18 only.*/
			replace schipct=. if pregnant & agem>=19 & state2==47 & date>=10204
			*KFF 12/09
			replace schipct=241 if agem<20 & state2==47 & date>=11001

		*Kentucky, 61 
			*MSB 88 		
			replace smedpct=100 if (pwi | agem<2) & state2==61 & date>=8710
			*IHPP1 89 		
			replace smedpct=125 if pwi & state2==61 & date>=8906
			*IHPP1 90 		
			replace smedpct=185 if pwi & state2==61 & date>=9010
			/*ed, LW 8/24/09 : I think this was a typo in the MCH 9/95 and 
			9/96 reports and contradicts later documentation. Hence I have 
			commented out this line of DR's code.*/
			*MCH 9/95 		
			*replace smedpct=100 if (date>=9505 & inrange(agem,1,18)) & state2==61
			*MCH 99, HMA 99
			replace smedpct=100 if inrange(agem,14,19) & state2==61 & date>=9807
			*MCH 00, HMA 99
			replace schipct=200 if inrange(agem,0,14) & state2==61 & date>9907
			replace smedpct=150 if inrange(agem,1,18) & state2==61 & date>=9904
			*MCH 01
			/*LW: discrepancy over timeline for expansion of coverage 
			for older children, follow MCH rather than HMA*/
			replace schipct=200 if inrange(agem,15,18) & state2==61 & date>=10004

		*Louisiana, 72
		    *DR: Ignored IHPP1 91 pwi=185, since it contradicted by MSB 93 and MCH 
			*IHPP1 88 		
			replace smedpct=100 if (pwi | (birthday>=8310 & agem<8)) & ///
				state2==72 & date>=8901
			*MCH 9/97
			replace smedpct=100 if inrange(agem,6,18) & state2==72 & date>=9703
			*MCH 99, HMA 99
			replace smedpct=133 if inrange(agem,6,19) & state2==72 & date>=9811
			*MCH 00
			replace smedpct=150 if agem<19 & state2==72 & date>=9904
			*MCH 01, KFF 06/02 indicates this was a Medicaid expansion
			replace smedpct=200 if agem<19 & state2==72 & date>=10101
			/*LW: MCH 02 reports that LA had enacted legislation to apply for a 
			SCHIP 1115 waiver to cover pregnant women up to 185% FPL. However, 
			MCH 03 does not show this increase, so I have ignored here.*/
			*MCH 06
			replace smedpct=200 if pregnant & state2==72 & date>=10406

		*Maine, 11 
			*IHPP1 88 		
			replace smedpct=185 if pwi & state2==11 & date>=8810
			*IHPP1 88 		
			replace smedpct=100 if inrange(agem,1,4) & state2==11 & date>=8810
			*MCH 5/93 	
			replace smedpct=125 if inrange(agem,1,19) & state2==11 & ///
				inrange(date,9207,9309)
			*MCH 2/94 		
			replace smedpct=125 if inrange(agem,1,18) & state2==11 & date>=9310
			*HMA 99
			replace smedpct=150 if inrange(agem,1,19) & state2==11 & date>=9807
			*MCH 99, HMA 99
			replace schipct=185 if inrange(agem,1,19) & state2==11 & date>=9808
			*MCH 00
			replace schipct=200 if inrange(agem,1,18) & state2==11 & date>=9904
			*MCH 01
			replace smedpct=200 if pwi & state2==11 & date>=10004

		*Maryland, 52 
			*IHPP1 88 		
			replace smedpct=100 if (pwi | (birthday>=8608 & agem<2)) & ///
				state2==52 & date>=8707
			*IHPP1 89 		
			replace smedpct=185 if pwi & state2==52 & date>=8906
			*IHPP1 89 	 	
			replace smedpct=100 if birthday>=8310 & inrange(agem,1,7) & ///
				state2==52 & date>=8906
			*MCH 12/93 		
			replace smedpct=185 if birthday>=8310 & agem<19 & state2==52 & ///
				date>=9304
			*MCH 99, HMA 99
			replace smedpct=200 if (agem<20 | pregnant) & state2==52 & date>=9807
			*MCH 02
			replace smedpct=250 if pregnant & state2==52 & date>=10104
			replace schipct=300 if agem<19 & state2==52 & date>=10104
			*KFF 1/08, in 2007 Maryland eliminated its separate SCHIP program
			/*LW: Assume implementation date halfway between date given in KFF 1/07
			(July 2006)  and KFF 1/08 (Jan 2008)*/
			replace smedpct=300 if agem<20 & state2==52 & date>=10704
			replace schipct=. if agem<19 & state2==52 & date>=10704

		*Massachusetts, 14 
			*MSB 88 		
			replace smedpct=100 if pwi & state2==14 & date>=8707
			*IHPP1 88 		
			replace smedpct=185 if pwi & state2==14 & date>=8807
			*IHPP1 88 		
			replace smedpct=100 if birthday>=8310 & inrange(agem,1,4) & ///
				state2==14 & date>=8807
			*IHPP1 IC 88 		
			replace smedpct=200 if pregnant & state2==14 & date>=8807
			*MCH 5/93 		
			replace smedpct=200 if (pwi | agem<6) & state2==14 & date>=9207
			*MCH 3/95 		
			replace smedpct=200 if agem<13 & state2==14 & date>=9411
			*MCH 9/97
			replace smedpct=133 if inrange(agem,6,18) & state2==14 & ///
				date>=9707
			*MCH 99, HMA 99
			replace smedpct=133 if inrange(agem,1,19) & state2==14 & date>=9710
			replace smedpct=150 if inrange(agem,1,19) & state2==14 & date>=9808
			replace schipct=200 if agem<19 & state2==14 & date>=9808
			/*LW: MCH 06 has a 200% FPL threshold listed for pregnant women under 
			SCHIP but only for this year.  I think this may be in error since a footnote
			in MCH 08 specifies that the 200% FPL threshold is under Medicaid but funded
			by SCHIP. The MCH updates tend to lump together SCHIP-funded Medicaid expansions
			and separate state SCHIP expansions. So, I ignore here.*/
			*MCH 08
			replace schipct=300 if agem<19 & state2==14 & date>=10607

		*Michigan, 34 
			*MSB 88 		
			replace smedpct=100 if (pwi | (birthday>=8602 & agem<5)) & ///
				state2==34 & date>=8801
			*IHPP1 88 		
			replace smedpct=185 if pwi & state2==34 & date>=8810
			*MCH 3/95 		
			replace smedpct=150 if birthday>=7907 & inrange(agem,1,18) & ///
				state2==34 & date>=9411
			*HMA 99
			replace smedpct=150 if inrange(agem,6,19) & state2==34 & date>=9805
			*MCH 99, HMA
			replace schipct=200 if agem<20 & state2==34 & date>=9809
			/*LW: MCH 02 specifies that pregnant women under the age of 19 are
			covered by SCHIP in Michigan for this year. But this is the case in 
			general, so I have not included here. It is coverage by SCHIP of 
			pregnant women older than age 19 that requires special approval
			from HHS. See footnote to Table 8 in MCH 06*/
			*MCH 06, MCH 08
			/*LW: Assume implementation date halfway between date given in MCH 06
			report (February 2006) and date given in MCH 03 report (Oct 2002)*/
			/*LW: Here I assume that if you are under age 20 and pregnant
			you still qualify for SCHIP under the 200% FPL child threshold
			rather than the 185% SCHIP threshold for pregnant women.*/
			replace schipct=185 if pregnant & agem>=20 & state2==34 & date>=10611

		*Minnesota, 41
			/*DR: Remember that all full families receive Medicaid if they are
			under 133 percent of the AFDC need standard (IHPP1 87,
			July 1987).
			IHPP1 87 is questionable.
			IHPP1 92 sets coverage at 275 percent of FPL to agree with later
			MCH documents, and it covers all families with pregnant
			women or children under 18 */
			*IHPP1 87 		
			replace smedpct=92 if pregnant & state2==41 & date>=8707
			*IHPP1 88 		
			replace smedpct=185 if pwi & state2==41 & date>=8807
			*IHPP1 89 		
			replace smedpct=100 if birthday>=8310 & inrange(agem,1,6) & ///
				state2==41 & date>=8907
			*IHPP1 90 		
			replace smedpct=100 if birthday>=8310 & inrange(agem,1,18) & ///
				state2==41 & date>=9007
			*IHPP1 92 	
			*ed LW, 8/25/09: changed DR's code to be more straightforward	
			*replace smedpct=275 if (skage0>0 | skage18>0) & state2==41 & date>=9210 
			replace smedpct=275 if (pregnant | agem<19) & state2==41 & date>=9210
			*LW: MCH 9/97 contradicts other MCH reports, ignore
			/*LW: Minnesota operates program under Section 1115 waiver, and all 
			populations may not receive subsidized services.*/
			*MCH 99
			/*LW: footnotes from later reports (MCH 01-03 and HMA 99) indicate
			"infant" includes children age 0-2*/
			replace smedpct=280 if inrange(agem,0,2) & state2==41 & date>=9810
			*MCH 06
			/*LW: Assume implementation date halfway between date given in MCH 06
			report (February 2006) and date given in MCH 03 report (Oct 2002)*/
			replace schipct=275 if pregnant & state2==41 & date>=10406		

		*Mississippi, 64 
			*MSB 88, IHPP1 87 	
			replace smedpct=100 if (pwi | (birthday>=8611 & agem<5)) & ///
				state2==64 & date>=8710
			*IHPP1 88 		
			replace smedpct=185 if pwi & state2==64 & date>=8810
			*IHPP1 89 		
			replace smedpct=100 if inrange(agem,1,4) & state2==64 & date>=8907
			*MCH 99, HMA 99
			replace smedpct=100 if inrange(agem,15,19) & state2==64 & date>=9805
			*MCH 00, HMA 99
			replace schipct=133 if inrange(agem,6,19) & state2==64 & date>=9901
			*MCH 02, MPR 01
			replace schipct=200 if agem<19 & state2==64 & date>=10001
			*MCH 08
			/*LW: Assume implementation date halfway between date given in MCH 08
			report (Aug 2007) and date given in MCH 06 report (Feb 06)*/
			replace schipct=200 if pregnant & state2==64 & date>=10611

		*Missouri, 43 
			*MSB 88 		
			replace smedpct=100 if (pwi | agem<2) & state2==43 & date>=8801
			*IHPP1 88 		
			replace smedpct=100 if agem<3 & state2==43 & date>=8810
			*MCH 12/93 		
			replace smedpct=185 if pwi & state2==43 & date>=9310
			*ed LW, 8/24/09: Believe a typo and changed upper age to 18 from 17
			*MCH 12/93 		
			replace smedpct=100 if inrange(agem,1,18) & state2==43 & date>=9310
			*MCH 99, HMA 99
			/*LW: HMA specifies it is 200%FPL, 300%FPL if gross income. However,
			neither MCH nor KFF mention this and specify only 300% FPL. I follow
			MCH and KFF here.*/
			replace smedpct=300 if agem<19 & state2==43 & date>=9807
			*KFF 1/08, Missouri created a separate SCHIP program in 2007
			/*LW: Assume implementation date halfway between date given in KFF 1/07
			(July 2006)  and KFF 1/08 (Jan 2008)*/
			replace smedpct=185 if pwi & state2==43 & date>=10704
			replace smedpct=150 if inrange(agem,1,19) & state2==43 & date>=10704
			replace schipct=300 if agem<20 & state2==43 & date>=10704

		*Montana, 81
			/*DR: IHPP1 90 and 91 dates are questionable.
			Ignored IHPP1 93 pwi=150 and <7=133, since contradicted in MSB 93
			and MCH */
			*IHPP1 89 		
			replace smedpct=100 if pwi & state2==81 & date>=8907
			/*ed LW, 8/25/09: commented out IHPP1 90 and IHPP1 91 since
			contradict all MCH reports I have dating back to 93, as well 
			as HMA. Plus federal mandates make IHPP1 91 pointless.*/
			*IHPP1 90 		
			*replace smedpct=185 if (date>=9007 & pwi) & state2==81
			*IHPP1 91 		
			*replace smedpct=133 if (date>=9107 & pwi) & state2==81
			*MCH 99, HMA 99
			replace schipct=150 if agem<20 & state2==81 & date>=9901
			*KFF 1/08, MCH 08
			replace smedpct=150 if pregnant & state2==81 & date>=10710
			replace schipct=175 if agem<19 & state2==81 & date>=10710
			*KFF 12/09
			replace smedpct=133 if inrange(agem,6,19) & state2==81 & date>=10910
			replace schipct=250 if agem<20 & state2==81 & date>=10910

		*Nebraska, 46 
			*IHPP1 88 		
			replace smedpct=100 if (pwi | (birthday>=8310 & agem<5)) & ///
				state2==46 & date>=8807
			*MCH 9/95 		
			replace smedpct=150 if pwi & state2==46 & date>=9505
			*HMA 99
			replace smedpct=100 if inrange(agem,15,18) & state2==46 & date>=9805
			*MCH 99, HMA 99
			replace smedpct=185 if (agem<20 | pregnant) & state2==46 & date>=9809
			/*LW: discrepancy in MCH 02 and MCH 03 over level of coverage 
			of 18 year olds, ignore*/
			*KFF 12/09
			replace smedpct=200 if inrange(agem,0,19) & state2==46 & date>=10909

		*Nevada, 88 
			*MCH 99, HMA 99
			replace schipct=200 if agem<19 & state2==88 & date>=9810
			/*LW: MCH 02 specifies that pregnant women under the age of 19 are
			covered by SCHIP in Nevada. But this is the case in general, so I 
			have not included here. It is coverage by SCHIP of pregnant women 
			older than age 19 that requires special approval from HHS. See footnote 
			to Table 8 in MCH 06*/
			*MCH 08
			/*LW: Assume implementation date halfway between date given in MCH 08
			report (Aug 2007) and date given in MCH 06 report (Feb 06)*/
			replace schipct=185 if pregnant & state2==88 & date>=10611		
			*KFF 01/12
			replace schipct=133 if pregnant & state2==88 & date>=11006

		*New Hampshire, 12
	        *DR: Ignored MCH 2/95, since it was contradicted by later MCH documents 
			*IHPP1 92 		
			replace smedpct=150 if pwi & state2==12 & date>=9207 
			*MCH 12/93 		
			replace smedpct=170 if (pwi | agem<11) & state2==12 & date>=9401
			*MCH 8/94 		
			replace smedpct=185 if (pwi | agem<19) & state2==12 & date>=9404
			*MCH 99, HMA 99
			replace smedpct=300 if agem==0 & state2==12 & date>=9805
			*MCH 00, HMA 99
			replace schipct=300 if inrange(agem,1,19) & state2==12 & date>=9901

		*New Jersey, 22
			/*DR: Ignored IHPP1 91 state2ment that disabled and working individuals
			were covered up to 200 percent of the FPL, since it was not
			mentioned in later MCH documents.
			IHPP1 91 date is questionable */
			*MSB 88 		
			replace smedpct=100 if (pwi | agem<2) & state2==22 & date>=8707
			*IHPP1 91 		
			replace smedpct=185 if pwi & state2==22 & date>=9107
			*MCH 12/93 		
			replace smedpct=300 if pwi & state2==22 & date>=9304
			*HMA 99
			replace smedpct=133 if agem<20 & state2==22 & date>=9802
			*MCH 99, HMA 99
			replace schipct=200 if agem<20 & state2==22 & date>=9803
			*MCH 00, MPR 01
			replace schipct=350 if agem<19 & state2==22 & date>=9907
			*MCH 02
			/*LW: Here I assume that if you are under age 19 and pregnant
			you still qualify for SCHIP under the 350% FPL child threshold
			rather than the contracted SCHIP threshold for pregnant women.*/
			replace schipct=200 if pregnant & agem>=19 & state2==22 & date>=10104
			*KFF 6/02
			/*LW: Kaiser reports indicate that NJ covers infants under Medicaid
			up to 200% FPL if born to mother enrolled in Medicaid
			Assume date of implementation halfway between 2000 (July 2000)
			and 2002 (Jan 2002) Kaiser surveys*/
			replace smedpct=200 if agem==0 & state2==22 & date>=10104

		*New Mexico, 85
	        *DR: IHPP1 87 subject to availability of funds 
			*IHPP1 87, 88 		
			replace smedpct=100 if (pwi | agem<5) & state2==85 & ///
				inrange(date,8801,8809)
			*IHPP1 88 		
			replace smedpct=100 if (pwi | (birthday>=8511 & agem<5)) & ///
				state2==85 & date>=8810
			*MSB 93 		
			replace smedpct=185 if pwi & state2==85 & date>=9201
			*MCH 9/95 	
			replace smedpct=185 if agem<19 & state2==85 & date>=9504
			*MCH 00, HMA 99
			replace smedpct=235 if agem<20 & state2==85 & date>=9808

		*New York, 21 
			*IHPP 89 		
			replace smedpct=185 if pwi & state2==21 & date>=9001
			*MCH 5/93 		
			replace smedpct=185 if agem<13 & state2==21 & date>=9207
			*MCH 2/94 		
			replace smedpct=160 if agem<13 & state2==21 & date>=9310
			*MCH 3/95 		
			replace smedpct=160 if agem<15 & state2==21 & date>=9411
			/*LW ed, 9/10/09: DR seems to have missed changes to NY law, 
			added here from MCH 9/95 and consistent with later MCH updates*/
			replace smedpct=185 if pwi & state2==21 & date>=9505
			replace smedpct=. if inrange(agem,1,14) & state2==21 & date>=9505
			*HMA 99
			replace schipct=185 if agem<20 & state2==21 & date>=9804
			*MCH 99
			replace schipct=222 if agem<19 & state2==21 & date>=9804
			*MCH 00
			replace schipct=192 if agem<19 & state2==21 & date>=9904
			*MCH 01
			replace schipct=250 if agem<19 & state2==21 & date>=10004	
			/*LW: MCH 02 specifies that pregnant women under the age of 19 are
			covered by SCHIP in New York. But this is the case in general, so I 
			have not included here. It is coverage by SCHIP of pregnant women 
			older than age 19 that requires special approval from HHS. See footnote 
			to Table 8 in MCH 06*/
			*KFF 6/02
			/*LW: Assume date of implementation halfway between 2000 (July 2000)
			and 2002 (Jan 2002) Kaiser surveys*/
			replace smedpct=200 if agem==0 & state2==22 & date>=10104
			*MCH 03
			replace smedpct=200 if pregnant & state2==21 & date>=10204

		*North Carolina, 56 
			*IHPP1 87 		
			replace smedpct=100 if (pwi | (birthday>=8511 & agem<5)) & ///
				state2==56 & date>=8710
			*IHPP1 89 		
			replace smedpct=100 if birthday>=8311 & agem<7 & state2==56 & ///
				date>=8910
			*IHPP1 89 		
			replace smedpct=150 if pwi & state2==56 & date>=9001
			*IHPP1 90 		
			replace smedpct=185 if pwi & state2==56 & date>=9010
			*MCH 3/95 		
			replace smedpct=100 if inrange(agem,1,18) & state2==56 & date>=9411
			*MCH 99, HMA 99
			replace schipct=200 if agem<20 & state2==56 & date>=9810
			*KFF 10/05
			/*LW: Assume date of implementation halfway between 2004 (July 2004)
			and 2005 (July 2005) Kaiser surveys*/
			replace smedpct=200 if agem<6 & state2==56 & date>=10501

		*North Dakota, 44 
			*ed LW, 8/24/09: it looks like DR left out an expansion first reported in 
			*MCH 9/95 and later MCH updates, add here:
			replace smedpct=100 if inrange(agem,6,18) & state2==44 & date>=9505
			*LW: reported expansion in HMA contradicts those in MCH reports, ignore
			*MCH 00
			replace schipct=140 if agem<19 & state2==44 & date>=9910
			*KFF 12/09
			replace schipct=160 if agem<20 & state2==44 & date>=10907

		*Ohio, 31 
			*MSB 88 		
			replace smedpct=100 if pwi & state2==31 & date>=8901
			*MCH 99, HMA 99
			replace smedpct=150 if agem<20 & state2==31 & date>=9809
			*MCH 01
			replace smedpct=200 if agem<19 & state2==31 & date>=10004
			replace smedpct=150 if pregnant & state2==31 & date>=10004
			*MCH 06
			/*LW: Assume implementation date halfway between date given in MCH 06
			report (February 2006) and date given in MCH 03 report (Oct 2002)*/
			replace schipct=200 if pregnant & state2==31 & date>=10406

		*Oklahoma, 73 
			*IHPP1 87 		
			replace smedpct=100 if (pwi | (birthday>=8602 & agem<4)) & ///
				state2==73 & date>=8801
			*MCH 5/93 		
			replace smedpct=150 if pwi & state2==73 & date>=9207
			*MCH 99, HMA 99
			/*LW: HMA says the expansion was phased in starting in December 1997, 
			but gives no details. MCH reports do not indicate phase-in. Here I've 
			used annual MCH reported eligibility levels.*/
			/*LW: MCH 99 specifies eligibility through age 17 only but this
			contradicts MCH 00 and HMA 99, which I follow here*/
			replace smedpct=185 if (agem<19 | pregnant) & state2==73 & date>=9712
			*MCH 06
			/*LW: Assume implementation date halfway between date given in MCH 06
			report (February 2006) and date given in MCH 03 report (Oct 2002)*/
			replace schipct=200 if pregnant & state2==73 & date>=10406

		*Oregon, 92 
			*MSB 88 		
			replace smedpct=85 if (pwi | agem<2) & state2==92 & date>=8711
			*IHPP1 88 		
			replace smedpct=100 if (pwi | agem<3) & state2==92 & date>=8809
			*MCH 9/95 		
			replace smedpct=100 if agem<19 & state2==92 & date>=9504
			*MCH 99, HMA 99
			replace schipct=170 if agem<20 & state2==92 & date>=9807
			replace smedpct=170 if pregnant & state2==92 & date>=9807
			*KFF 7/03, MCH 06
			replace schipct=185 if agem<19 & state2==92 & date>=10209
			replace smedpct=185 if pregnant & state2==92 & date>=10209
			*KFF 12/09
			replace schipct=300 if agem<20 & state2==92 & date>=10910

		*Pennsylvania, 23
			/*DR: Ignored IHPP 92 and MCH statements that starting in 9304??
			children under 6 between 185 and 235 percent of FPL
			are covered on a sliding scale */
			*IHPP1 88 		
			replace smedpct=100 if (pwi | (birthday>=8511 & agem<3)) ///
				& state2==23 & date>=8710
			*MCH 5/93 		
			replace smedpct=185 if pwi & state2==23 & date>=9207
			*IHPP1 92 		
			replace smedpct=185 if agem<6 & state2==23 & date>=9304
			*MCH 8/94 		
			replace smedpct=185 if agem<14 & state2==23 & date>=9404
			/*ed LW, 9/10/09: DR's code missing some changes in later MCH updates, 
			which I've added here*/
			*MCH 3/95
			replace smedpct=185 if agem<15 & state2==23 & date>=9411
			*MCH 9/95
			replace smedpct=. if inrange(agem,1,14) & state2==23 & date>=9505
			*MCH 99, HMA 99
			replace schipct=235 if agem<20 & state2==23 & date>=9805
			*KFF 1/08, MCH 08
			replace schipct=300 if agem<19 & state2==23 & date>=10710
			/*LW: MCH 08 specifies that pregnant women under the age of 19 are
			covered by SCHIP in Pennsylvania. But this is the case in general, so I 
			have not included here. It is coverage by SCHIP of pregnant women 
			older than age 19 that requires special approval from HHS. See footnote 
			to Table 8 in MCH 06*/

		*Rhode Island, 15
			/*DR: Ignored MCH 12/93 expansion, since it is contradicted in later MCH
			documents */
			*IHPP1 87 		
			replace smedpct=100 if (pwi | (birthday>=8310 & agem<5)) ///
				& state2==15 & date>=8707
			*IHPP1 88 		
			replace smedpct=185 if pwi & state2==15 & date>=8810
			*MCH 5/93 		
			replace smedpct=200 if pregnant & state2==15 & date>=9207
			*MCH 3/95 		
			replace smedpct=350 if pregnant & state2==15 & date>=9411
			*MCH 3/95 		
			replace smedpct=250 if agem<7 & state2==15 & date>=9411
			*MCH 97, HMA 99
			replace smedpct=250 if (pregnant | agem<19) & state2==15 & date>=9705
			*MCH 03
			replace smedpct=185 if pregnant & state2==15 & date>=10204
			replace schipct=250 if pregnant & state2==15 & date>=10204

		*South Carolina, 57 
			*MSB 88 		
			replace smedpct=100 if pwi & state2==57 & date>=8710
			*MSB 93 		
			replace smedpct=185 if pwi & state2==57 & date>=9201
			*MCH 97, HMA 99
			replace smedpct=150 if inrange(agem,1,18) & state2==57 & date>=9710

		*South Dakota, 45 
			*IHPP1 88 		
			replace smedpct=100 if pwi & state2==45 & date>=8807
			*ed LW, 8/24/09: DR missed an expansion first reported in MCH 3/96
			*MCH 3/96
			replace smedpct=100 if inrange(agem,6,19) & state2==45 & date>=9511
			*MCH 99, HMA 99
			replace smedpct=133 if inrange(agem,6,19) & state2==45 & date>=9807
			*MCH 00, MPR 01
			replace smedpct=140 if agem<19 & state2==45 & date>=9904
			*MCH 01, KFF 6/02 indicates this is a separate SCHIP program
			replace schipct=200 if agem<19 & state2==45 & date>=10004

		*Tennessee, 62
			/*DR: Ignored MCH 9/96 claim that all uninsured individuals under
			400 percent of FPL are covered since March, 1993.  It
			appears that at least some people must pay premiums */
			*IHPP1 87, 88 		
			replace smedpct=100 if (pwi | agem<2) & state2==62 & date>=8707
			*IHPP1 88 		
			replace smedpct=100 if birthday>=8310 & agem<5 & state2==62 & ///
				date>=8807
			*IHPP1 90 		
			replace smedpct=185 if pwi & state2==62 & date>=9107
			/*LW: Following DR, I ignore the claim in the MCH update that 
			Tennessee covers populations up to 400% FPL since it appears 
			that many of these individuals would need to pay premiums. Bruce
			mentioned in a 9/2/09 meeting that he believed this treatment was
			unique for TN since there was some evidence of either a shortage of 
			state funding to support the expansion or significant cost-sharing
			requirements that led no one to take up coverage. He could not 
			recall the exact reason but remembered making the call with DR.*/
			*MCH 00
			replace smedpct=200 if inrange(agem,6,18) & state2==62 & date>=9904
			*MCH 01, MCH 02, MCH 03
			replace smedpct=200 if agem<6 & state2==62 & date>=10004
			*KFF 7/03, MCH 06
			/*LW: It is not clear if the contraction reported in MCH 06 is in 
			error but KFF reports these eligibility levels for the 
			July 2003 - 2006, so I am assuming not.*/
			replace smedpct=185 if agem==0 & state2==62 & date>=10312
			replace smedpct=133 if inrange(agem,1,5) & state2==62 & date>=10312
			replace smedpct=100 if inrange(agem,6,18) & state2==62 & date>=10312
			*KFF 1/08, MCH 08
			replace schipct=250 if (agem<19 | pregnant) & state2==62 & date>=10710

		*Texas, 74 
			*IHPP1 88 		
			replace smedpct=100 if (pwi | agem<2) & state2==74 & date>=8809
			*IHPP1 89 		
			replace smedpct=130 if pwi & state2==74 & date>=8909
			*IHPP1 89 		
			replace smedpct=100 if birthday>=8510 & inrange(agem,1,5) & ///
				state2==74 & date>=8909
			*MSB 93 		
			replace smedpct=185 if pwi & state2==74 & date>=9201
			*MCH 99, HMA 99
			replace smedpct=100 if inrange(agem,15,19) & state2==74 & date>=9807
			*MCH 00, KFF 10/00 indicates this is a separate state program
			replace schipct=200 if agem<19 & state2==74 & date>=9904
			*MCH 02
			replace schipct=200 if pregnant & state2==74 & date>=10104
			*MCH 03
			/*LW: Here I assume that if you are under age 19 and pregnant
			you still qualify for SCHIP under the 200% FPL child threshold
			rather than the contracted SCHIP threshold for pregnant women.*/
			replace schipct=. if pregnant & agem>=19 & state2==74 & date>=10204
			*MCH 08
			replace schipct=200 if pregnant & state2==74 & date>=10610

		*Utah, 87 
			*IHPP1 88 		
			replace smedpct=100 if pwi & state2==87 & date>=8901
			*MCH 3/95 	
			replace smedpct=100 if agem<19 & state2==87 & date>=9411
			*MCH 99, HMA 99
			replace schipct=200 if agem<20 & state2==87 & date>=9808

		*Vermont, 13 
			*IHPP1 87, 88 		
			replace smedpct=100 if pwi & state2==13 & date>=8710
			*IHPP1 88 		
			replace smedpct=185 if pwi & state2==13 & date>=8807
			*IHPP1 88 		
			replace smedpct=100 if birthday>=8310 & inrange(agem,1,5) & ///
				state2==13 & date>=8807
			*MCH 5/93 		
			replace smedpct=200 if pregnant & state2==13 & date>=9207
			*MCH 5/93 		
			replace smedpct=225 if agem<19 & state2==13 & date>=9207
			*MCH 99, HMA 99
			replace schipct=300 if agem<19 & state2==13 & date>=9810

		*Virginia, 54 
			*IHPP1 88 		
			replace smedpct=100 if pwi & state2==54 & date>=8807
			*MCH 12/93  
			replace smedpct=100 if agem<19 & state2==54 & date>=9304
			*MCH 99, HMA 99
			replace schipct=185 if agem<20 & state2==54 & date>=9810
			*MCH 02
			replace schipct=200 if agem<19 & state2==54 & date>=10104
			*KFF 7/03
			/*LW: Assume implementation date falls halfway between 2002 
			(Jan 2002) and 2003 (April 2003) Kaiser surveys*/
			replace smedpct=133 if agem<20 & state2==54 & date>=10209
			*MCH 06
			/*LW: Below I assume that if you are under age 19 and pregnant
			you still qualify for SCHIP under the 200% FPL child threshold
			rather than the 150%, 166% or 185% FPL SCHIP threshold for pregnant women.*/
			replace schipct=150 if pregnant & agem>=19 & state2==54 & date>=10508
			*MCH 08
			replace schipct=166 if pregnant & agem>=19 & state2==54 & date>=10608
			replace schipct=185 if pregnant & agem>=19 & state2==54 & date>=10610
			*KFF 12/09
			replace schipct=200 if pregnant & state2==54 & date>=10907

		*Washington, 91
			/*DR: Ignored MCH 3/95, since it contradicted earlier and later MCH
			documents */
			*IHPP1 87 		
			replace smedpct=90 if pwi & state2==91 & date>=8707
			*IHPP1 87 		
			replace smedpct=90 if agem<2 & state2==91 & date>=8710
			*IHPP1 89 		
			replace smedpct=185 if pwi & state2==91 & date>=8908
			*IHPP1 89 		
			replace smedpct=100 if birthday>=8310 & inrange(agem,1,18) & ///
				state2==91 & date>=8908
			*MCH 5/93 		
			replace smedpct=100 if inrange(agem,1,18) & state2==91 & date>=9207
			*MCH 8/94 	
			*ed LW, 9/10/09: typo by DR, changed code to include infants	
			*replace smedpct=200 if inrange(agem,1,18) & state2==91 & date>=9404
			replace smedpct=200 if agem<19 & state2==91 & date>=9404
			*MCH 00, HMA 99
			replace schipct=250 if agem<20 & state2==91 & date>=9904
			*MCH 06
			/*LW: Assume implementation date halfway between date given in MCH 06
			report (February 2006) and date given in MCH 03 report (Oct 2002)*/
			/*LW: Below I assume that if you are under age 20 and pregnant
			you still qualify for SCHIP under the 250% FPL child threshold
			rather than the 185% FPL SCHIP threshold for pregnant women.*/
			replace schipct=185 if pregnant & agem>=20 & state2==91 & date>=10406
			*KFF 12/09
			replace schipct=300 if agem<20 & state2==91 & date>=10901

		*West Virginia, 55 
			*IHPP1 87 		
			replace smedpct=100 if (pwi | (birthday>=8608 & agem<5)) & ///
				state2==55 & date>=8707
			*IHPP1 88 		
			replace smedpct=150 if pwi & state2==55 & date>=8807
			*IHPP1 88 		
			replace smedpct=100 if birthday>=8310 & inrange(agem,1,7) & ///
				state2==55 & date>=8807
			*MCH 12/93 		
			replace smedpct=150 if agem<21 & state2==55 & inrange(date,9304,9309)
			*MCH 2/94 		
			replace smedpct=150 if agem<19 & state2==55 & date>=9310 
			/*ed LW, 8/24/09: MCH update reports 9/95 and later indicate a 
			contraction in eligibility before later expansions. DR may have 
			decided to overlook these in case they were a typographical error 
			but I have included them here to at least be more conservative, 
			especially since they are consistently reported for MCH 9/95, 
			3/96, 9/96, 9/97.*/
			*MCH 9/95
			replace smedpct=100 if inrange(agem,6,19) & state2==55 & date>=9505		
			replace smedpct=133 if inrange(agem,1,5) & state2==55 & date>=9505		
			*MCH 99, HMA 99
			replace smedpct=150 if inrange(agem,1,5) & state2==55 & date>=9807
			*MCH 00, HMA 99
			/*HMA indicates that this is a SCHIP-Medicaid expansion but KFF reports
			suggest that the expansions are separate SCHIP. I follow KFF.*/
			replace schipct=150 if inrange(agem,6,18) & state2==55 & date>=9903
			*MCH 02
			replace schipct=200 if (agem<19 | pregnant) & state2==55 & date>=10104
			*KFF 7/03
			/*LW: Assume implementation date falls halfway between 2002 
			(Jan 2002) and 2003 (April 2003) Kaiser surveys*/
			replace smedpct=133 if inrange(agem,1,5) & state2==55 & date>=10209
			*MCH 03
			/*LW: Below I assume that if you are under age 19 and pregnant
			you still qualify for SCHIP under the 200% FPL child threshold.*/
			replace schipct=. if pregnant & agem>=19 & state2==55 & date>=10204
			*KFF 1/07, MCH 08
			replace schipct=220 if agem<19 & state2==55 & date>=10601
			*KFF 12/09
			replace schipct=250 if agem<20 & state2==55 & date>=10901
			*KFF 01/12
			replace schipct=300 if agem<20 & state2==55 & date>=11107

		*Wisconsin, 35
	        *DR: Ignored IHPP1 89 pwi=130, since contradicted by IHPP1 90 
			*IHPP1 88 		
			replace smedpct=120 if pwi & state2==35 & date>=8809
			*IHPP1 90 		
			replace smedpct=155 if pwi & state2==35 & date>=9007
			*MCH 5/93 		
			replace smedpct=155 if agem<6 & state2==35 & date>=9207
			*MCH 9/95 		
			replace smedpct=185 if (pwi | agem<6) & state2==35 & date>=9504
			*HMA 99
			replace smedpct=100 if inrange(agem,15,18) & state2==35 & date>=9807
			*MCH 00, HMA 99
			replace smedpct=185 if agem<19 & state2==35 & date>=9907
			*MCH 01
			/*LW: Kaiser reports never recognize this increase to 200% FPL but 
			it is consistently reported in MCH.  I follow MCH and also consider
			it to be a Medicaid expansion as presented in MCH 01.*/
			replace smedpct=200 if agem<19 & state2==35 & date>=10004
			*MCH 02
			replace schipct=200 if pregnant & state2==35 & date>=10104

		*Wyoming, 83 
			*IHPP1 88, MCH 5/93 	
			replace smedpct=100 if pwi & state2==83 & date>=8810
			*MCH 00
			replace schipct=133 if inrange(agem,6,18) & state2==83 & date>=9904
			*KFF 10/04
			replace schipct=185 if agem<19 & state2==83 & date>=10312
			*KFF 10/05, MCH 06
			replace schipct=200 if (agem<19 | pregnant) & state2==83 & date>=10501

	*	MEDPCT is the maximum of the state2 and federal Medicaid percent of
	*	poverty line rules
		gen medpct=max(fmedpct,smedpct,-999999)

		replace schipct=-999999 if schipct==.

	    gen minc2=.
		replace minc2=minc-dis2 if ~post1997
		replace minc2=minc-min(mearn,medflat*workers)-medfract*max(0,mearn-medflat) if post1997

	    gen melig=1*(round((medpct/100)*mfpl,.001)>=round(minc2,.001))
		*added to identify source of medicaid eligibililty, 1/15/10
		gen fmelig=1*(medpct==fmedpct) 
		gen schpelig=1*(round((schipct/100)*mfpl,.001)>=round(minc-min(chpflat*workers,mearn),.001))
		replace schpelig=1 if round((schipct/100)*mfpl,.001)>=round(minc-.2*mearn) & state2==42
end
